package com.situ.mallsdauweb.controller;

import com.situ.mallsdauweb.service.IMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/")
public class LoginController {
    @Autowired
    private IMemberService memberService;

    @GetMapping("/login")
    public String login() {
        return "login";
    }
    @PostMapping("/login")
    public String doLogin(String username,String password) {
        boolean b=memberService.check(username,password);
        if(b){
            //请求转发
            //重定向
            return "redirect:/index";
        }else {
            return "login";
        }
    }
}
